﻿using System.Collections.Generic;
using System.Data;

using DAL;
using Model;
using System;

namespace BLL
{
    public  class EnterpriseUserBLL
    {
        public EnterpriseUserBLL()
        {
        }

        /// <summary>
        /// 得到最大ID
        /// </summary>
        public int GetMaxId()
        {
            return EnterpriseUserDAL.GetMaxId();
        }

        /// <summary>
        /// 判断登录
        /// </summary>
        public bool CheckLogin(EnterpriseUser enterpriseUser)
        {
            return EnterpriseUserDAL.CheckLogin(enterpriseUser);
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int ID)
        {
            return EnterpriseUserDAL.Exists(ID);
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string userName)
        {
            return EnterpriseUserDAL.Exists(userName);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(EnterpriseUser model)
        {
            return EnterpriseUserDAL.Add(model);
        }

        public string GetIncNameByUser(string strWhere)
        {
            return EnterpriseUserDAL.GetIncNameByUser(strWhere);
        }

        public string GetEnterpriseIdByUser(string strWhere)
        {
            return EnterpriseUserDAL.GetEnterpriseIdByUser(strWhere);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(EnterpriseUser model)
        {
           return  EnterpriseUserDAL.Update(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int UpdateContact(EnterpriseUser model)
        {
            return EnterpriseUserDAL.UpdateContact(model);
        }

        public int UpdateFirstTimeLogon(string users_id,DateTime updateTime )
        {
            return EnterpriseUserDAL.UpdateFirstTimeLogon(users_id,updateTime);
        }

        public int UpdatePassword(string userName, string passWord)
        {
            return EnterpriseUserDAL.UpdatePassword(userName, passWord);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(int ID)
        {
            EnterpriseUserDAL.Delete(ID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public EnterpriseUser GetModel(int ID)
        {
            return EnterpriseUserDAL.GetModel(ID);
        }


        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetListAll()
        {
            return EnterpriseUserDAL.GetListAll();
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<EnterpriseUser> GetModelList(string strWhere)
        {
            DataSet ds = EnterpriseUserDAL.GetListAll();
            List<EnterpriseUser> modelList = new List<EnterpriseUser>();
            int rowsCount = ds.Tables[0].Rows.Count;
            if (rowsCount > 0)
            {
                EnterpriseUser model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new EnterpriseUser();

                    //TODO: ADD MODEL
                    modelList.Add(model);
                }
            }
            return modelList;
        }
    }
}
